import {getAdminMenu} from "@/api/system";

const state = {
    menuTree:[],
    //后台枚举值，这些需要写死
    sysDict:[
        {codeName:"enabled",codeText:"是",codeValue:true},
        {codeName:"enabled",codeText:"否",codeValue:false},

        {codeName:"status",codeText:"是",codeValue:true},
        {codeName:"status",codeText:"否",codeValue:false},

        {codeName:"fieldType",codeText:"文本",codeValue:"String"},
        {codeName:"fieldType",codeText:"布尔",codeValue:"Boolean"},
        {codeName:"fieldType",codeText:"长整型",codeValue:"Long"},
        {codeName:"fieldType",codeText:"整型",codeValue:"Int"},

    ]

}

const mutations = {

}

const actions = {
    //加载后台系统菜单
    loadAdminMenu({state}){
        getAdminMenu()
            .then( res =>{
                state.menuTree = [...res.data]
            })
            .catch( err =>{
                console.log(err)
            })
    }
}

const getters = {

}

export default {
    state,mutations,actions,getters
}
